
<template>
  <j-modal
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    :title="title"
    :visible="visible"
    :width="width"
    cancelText="关闭"
    switchFullscreen
    @cancel="handleCancel"
    @ok="handleOk">
    <savepoint-list  ref="savepointlist" @getSavePointId="getSavePointId"></savepoint-list>
  </j-modal>
</template>
<script>

import savepointList from './SavepointBackupList.vue'
import {restoreSp} from '@api/apiStreamPlat'

export default {
  components: { savepointList },
  data() {
    return {
      title: '从保存点恢复任务',
      width: 1200,
      visible: false,
      show: false,
      jobConifgId:null,
      savePointId:null
    }
  },

  methods: {
    list(record){
      this.visible = true;
      console.log("恢复点数据",record)
      this.jobConfigId = record.id
      this.$nextTick(()=>{
        this.$refs.savepointlist.queryList(record.id);
      })
    },
    close () {
      this.visible = false;
    },

    handleOk () {
      this.$confirm({
        content: '是否从该保存点恢复？',
        onOk: () => {
          let param = {}
          param.id = this.jobConfigId
          param.savepointId = this.savepointId
          restoreSp(param).then((res) => {
            if (res.success) {
              this.dataSource = res.result;
            }
          }).catch({
            message: '恢复失败'
          }).finally(() => {
            this.visible = false
          })
        },
      })
    },
    handleCancel () {
      this.close()
    },
    getSavePointId(savePointId){
      console.log("保存点id",savePointId)
      this.savepointId = savePointId
    }

  }
}
</script>



<style scoped>

</style>